﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Ccit.OA.MsGroup;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Ccit.OA.Group
{
    public partial class group_personal_edit : Ccit.Utils.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                _hidsRecId.Value = (Request.QueryString["Id"] != null) ? Request.QueryString["Id"].ToString() : "";
                _hidType.Value = (Request.QueryString["type"] != null) ? Request.QueryString["type"].ToString() : "";                
            }
            InitPage();
        }
        private void InitPage()
        {
            if (_hidsRecId.Value != "")
            {
                GroupBLL Bll = new GroupBLL();
                MsGroupMes ms = Bll.GetGroupMesInfo(_hidsRecId.Value);
                txtName.Text = ms.GroupName;
                Bll = null;
            }
        }
        #region Ajax Methods
        [global::System.Web.Services.WebMethod]
        public static string DoSaveMes(string strJson, string cType)
        {
            GroupBLL Bll = new GroupBLL();
            MsGroupMes ms = (MsGroupMes)JavaScriptConvert.DeserializeObject(strJson, typeof(MsGroupMes));
            List<string> lstResult = Bll.DoSaveGroupMes(ms);
            var newObj = new { result = lstResult[0], message = lstResult[2], groupname=lstResult[1],ctrtype = cType };
            string serExpr = JavaScriptConvert.SerializeObject(newObj);
            Bll = null;
            newObj = null;
            return serExpr;
        }
        #endregion
    }
}
